import 'package:flutter/cupertino.dart';
import 'package:s_k_todo/data/base_data.dart';

import '../data/dio_static.dart';
import '../model/task_model.dart';

class TaskInfoProvider extends ChangeNotifier {
  TaskApi api = TaskApi(DioStatic
      .getInstance()
      .dio);
  final int taskId;
  TaskInfo? task;

  TaskInfoProvider(this.taskId) {
    init();
  }

  void init() async {
    BaseData<TaskInfo> data = await api.getTaskDetail(taskId);
    if (data.code == 0 && data.data != null) {
      task = data.data;
      notifyListeners();
    }
  }
}
